﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace StarcraftBot {
    public static class Logger {
        public static string Filename = Settings.Settings.LogFilename;
        //static StreamWriter sw = new StreamWriter(Filename);
        static StreamWriter sw = File.AppendText(Filename);

        public static void AddAndPrint(string message) {
            //sw.WriteLine(message);
            message = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss | ") + message;
            lock (sw) {
                sw.WriteLine(message);
                sw.Flush();
                if (Settings.Settings.Debug) Wrapper.Game.PrintText(message);
            }
        }

        public static void AddAndPrint() {
            AddAndPrint(string.Empty);
        }



    }
}
